<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="joda" uri="http://www.joda.org/joda/time/tags"%>
<t:masterpage>
	<jsp:body>
        <c:url value="/static/img/photo" var="imageFolderUrl" />
        <c:url value="/staff" var="staffUrl" />
        <c:url value="/donations" var="donationsUrl" /> 
        <h2>Registered Staff</h2>
        <div class="form-actions">
            <a class="btn btn-primary" href="${staffUrl}/add.html">Add new person</a>
        </div>
        <table id="staff" class="table table-hover">
            <thead>
                <tr>
                    <th>Photo</th>
                    <th>Description</th>
                    <th>Donations</th>
                    <th>Editing</th>
                    <th>Removing</th>
                </tr>
            </thead>
            
            <tbody>
                <c:forEach items="${staffManagementPageModel.people}"
					var="person">
                    <tr>
                        <td>
                            <img class="photo_small"
							alt="${person.firstName} ${person.lastName}"
							src="${imageFolderUrl}/${person.photoPath}" />
                        </td>
                        <td>
                            <dl>
                                <dt>First name</dt>
                                <dd>${person.firstName}</dd>
                                <c:if
									test="${person.middleName != null && not empty person.middleName}">
                                    <dt>Middle name</dt>
                                    <dd>${person.middleName}</dd>
                                </c:if>
                                <dt>Last name</dt>
                                <dd>${person.lastName}</dd>
                                <dt>Birthday</dt>
                                <dd>
                                    <joda:format
										value="${person.birthday}" pattern="dd.MM.yyyy" />
                                </dd>
                            </dl>
                        </td>
                        <td>
                            <a class="btn" href="${donationsUrl}/${person.id}.html">Open</a>
                        </td>
                        <td>
                            <a class="btn" href="${staffUrl}/${person.id}/update.html">Edit</a>
                        </td>
                        <td>
                            <a class="btn"  href="${staffUrl}/${person.id}/remove.html">Remove</a>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </jsp:body>
</t:masterpage>
